// $Id: VersionDetailPage.java 54 2011-10-23 18:22:29Z huijzer@gmail.com $
package lime.browser.editor;

import lime.application.model.properties.PersistentObjectProperty;
import lime.application.model.properties.SysObjectProperty;
import lime.model.Version;

import org.eclipse.swt.widgets.Text;

public class VersionDetailPage extends RepositoryObjectDetailPage {

	// Widgets
	Text objectIdText;
	Text objectNameText;
	Text versionLabelText;
	Text modifyDateText;
	Text modifierText;
	Text logEntryText;
	Text objectTypeText;
	Text contentTypeText;
	Text lockOwnerText;
	Text linkCntText;
	Text isReplicaText;

	public VersionDetailPage() {
		super("Version details");
	}
	
	@Override
	public void addTextWidgets() {
		
		objectIdText = addTextWidget(PersistentObjectProperty.R_OBJECT_ID);
		objectNameText = addTextWidget(SysObjectProperty.OBJECT_NAME);
		versionLabelText = addTextWidget(SysObjectProperty.R_VERSION_LABEL);
		modifyDateText = addTextWidget(SysObjectProperty.R_MODIFY_DATE);
		modifierText = addTextWidget(SysObjectProperty.R_MODIFIER);
		logEntryText = addTextWidget(SysObjectProperty.LOG_ENTRY);
		objectTypeText = addTextWidget(SysObjectProperty.R_OBJECT_TYPE);
		contentTypeText = addTextWidget(SysObjectProperty.A_CONTENT_TYPE);
		lockOwnerText = addTextWidget(SysObjectProperty.R_LOCK_OWNER);
		linkCntText = addTextWidget(SysObjectProperty.R_LINK_CNT);
		isReplicaText = addTextWidget(PersistentObjectProperty.I_IS_REPLICA);
	}

	@Override
	public void update() {

		Version version = (Version) getInput();

		if (version != null) {
			objectIdText.setText(version.getObjectId());
			objectNameText.setText(version.getObjectName());
			versionLabelText.setText(version.getVersionLabel());
			modifyDateText.setText(version.getModifyDate());
			modifierText.setText(version.getModifier());
			logEntryText.setText(version.getLogEntry());
			objectTypeText.setText(version.getObjectType());
			contentTypeText.setText(version.getContentType());
			lockOwnerText.setText(version.getLockOwner());
			linkCntText.setText(version.getLinkCnt());
			isReplicaText.setText(version.getIsReplica());
		}
	}
}
